<extend name="Common/common" />
<block name="main">
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <include file="Common/nav-header"/> <!--顶部-->
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加服务</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t " method="post" action="{:U('add')}" enctype="multipart/form-data">
                        <input type="hidden" name='id' value="{$_GET['id']}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">名称：</label>
                            <div class="col-sm-8">
                                <input  type="text" id="name" class="form-control" name="name" value="{$datalists.name}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">简介：</label>
                            <div class="col-sm-8">
                                <input  type="text" id="introduce" class="form-control" name="introduce" value="{$datalists.introduce}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">服务详情：</label>
                            <div class="col-sm-8">
                                <!-- 加载编辑器的容器 -->
                                <script id="container" name="detail" type="text/plain">
                                    {$datalists['detail']|html_entity_decode}
                                </script>
                                <!-- 配置文件 -->
                                <script type="text/javascript" src="__PUBLIC__/static/ueditor/ueditor.config.js">
                                </script>
                                <!-- 编辑器源码文件 -->
                                <script type="text/javascript" src="__PUBLIC__/static/ueditor/ueditor.all.js"></script>
                                <!-- 实例化编辑器 -->
                                <script type="text/javascript">
                                    var ue = UE.getEditor('container');
                                </script>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">图片上传：</label>
                            <div class="col-sm-3">
                                <input  type="file" id="pic" name="pic" value="{$datalists.pic}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">排序：</label>
                            <div class="col-sm-3">
                                <input  type="text" id="sort" class="form-control" name="sort" value="{$datalists.sort}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否显示：</label>
                            <input type="radio"  value="0"  name="is_display" <if condition="($datalists.is_display neq 1)">checked </if> />
                            否
                            <input type="radio"  value="1"  name="is_display" <if condition="($datalists.is_display eq 1)">checked </if> />
                            是
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--尾部-->
        <include file="Common/admin:footer"/>
    </div>

    <script>
        $('form').submit(function(){
            var name = $('#high_name').val();
            var sort = $("#sort").val();
            if(name == ''){
                layer.msg('请填写名称',{time:1000});
                return false;
            }
            if(!sort || isNaN(sort)){
                layer.msg('请填写排序，并且为数字',{time:1000});
                return false;
            }
        });
    </script>
</block>

